package com.zyzd.baseretrofit.activity;


import android.content.Intent;
import android.text.TextUtils;

import com.zyzd.baseretrofit.MainActivity;
import com.zyzd.baseretrofit.R;
import com.zyzd.baseretrofit.base.activity.BaseNetActivity;
import com.zyzd.baseretrofit.bean.remote.LoginBean;
import com.zyzd.commontools.cache.SpUtil;

public class LoginActivity extends BaseNetActivity<LoginBean> {

    @Override
    protected void parseData(LoginBean loginBean) {
        //
        if (!TextUtils.isEmpty(loginBean.getToken())) {
            SpUtil.putString("token", loginBean.getToken());
            Intent intent = new Intent(this, MainActivity.class);
            startActivity(intent);
            finish();
        }
    }

    @Override
    public void initData() {
        toSubscribe(getApi().login("15659184361", "362132"), getSubscriber());
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_login;
    }

}
